package cn.mumzone.pos.ui.adapter.inventory;

import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import cn.mumzone.pos.ui.fragment.inventory.FRA_InventoryItem;

/**
 * Created By Dlx
 * on 2019/9/25
 */
public class ADA_InventoryForVp extends FragmentPagerAdapter {

    private FRA_InventoryItem all;
    private FRA_InventoryItem not_start;
    private FRA_InventoryItem inventorying;
    private FRA_InventoryItem finish;

    public ADA_InventoryForVp(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int i) {
        if (i == 0) {
            if (all == null) {
                all = FRA_InventoryItem.newInstance(FRA_InventoryItem.TYPE_ALL);
            }
            return all;
        }
        if (i == 1) {
            if (not_start == null) {
                not_start = FRA_InventoryItem.newInstance(FRA_InventoryItem.TYPE_NOT_STARTED);
            }
            return not_start;
        }
        if (i == 2) {
            if (inventorying == null) {
                inventorying = FRA_InventoryItem.newInstance(FRA_InventoryItem.TYPE_INVENTORYING);
            }
            return inventorying;
        }
        if (i == 3) {
            if (finish == null) {
                finish = FRA_InventoryItem.newInstance(FRA_InventoryItem.TYPE_FINISH);
            }
            return finish;
        }
        return null;
    }

    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {

    }

    @Override
    public void destroyItem(@NonNull View container, int position, @NonNull Object object) {

    }
}
